<?php

		session_start();
		require_once "db.php";	
		include "header.php";

		?>

		<?php

		$query2 = "SELECT m.id, m.name as name,p.date,h.name as hall,c.name as cinema ,p.id as film_id FROM  movies m join projection p on(m.id=p.film_id) join halls h on(p.hall_id=h.id) join cinemas c on(h.cinema_id=c.id) where m.name like \"%".$_GET["SearchFilm"]."%\""; 
		$result2 = db_query($query2);
		$br=mysqli_num_rows ($result2);
		//$row2= $result2->fetch_fields();
		//$str0=$result2->
		echo "Search Results for: ".$_GET["SearchFilm"]."<br/>";
			echo "<table><tr><td>name:</td><td>time:</td><td>hall:</td><td>cinema:</td></tr>";
		for ($i=0;$i<=$br;$i++) {
    $result2->data_seek($i);

    /* fetch row */
    $row2 = $result2->fetch_row();
    echo "  <tr><td>".$row2[1]." </td><td> ".$row2[2]."</td><td>  ".$row2[3]." </td><td> ".$row2[4]."  </td></tr>";
    //printf ("City: %s  Countrycode: %s\n", $row2[0], $row2[1]);

}
		echo "</table>";
		?>
		<?php
		include "footer.php";
		?>